﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;
using System.Linq;
using System.Data.Linq;
using WX.WMS.DataModel;
using WX.WMS.Common;
using WX.WMS.BLL;

public partial class User_SysUserSearch :PageBase
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            init();
        }

    }

    protected void init()
    {
        object action = Request.QueryString["action"];
        if (action == null)
        {
            searchBand();
        }
        else if (action.ToString().Equals("del"))
        {
            string ID = Request.QueryString["ID"].ToString();
            UserBLL BllUser = new UserBLL();
            T_SYS_USER user = BllUser.GetUserByID(ID);
            user.STATUS = 0;
            if (BllUser.Update(user)< 0)
            {
                ShowMessage("修改失败");
                
            }
            else {
              
                searchBand();
            }
            

        }

    }



    /// <summary>
    /// 
    /// </summary>
    protected void searchBand()
    {
        SearchResult.DataSource = new UserBLL().GetUserList();
        SearchResult.DataBind();
    }

   
    ///// <summary>
    ///// 暂停用户活动
    ///// </summary>
    //public bool lockUser(string UserName)
    //{
    //   return Leyp.SQLServerDAL.Factory.getUserDAL().lockUser(UserName);
    
    //}


    //protected void SearchResult_RowDeleting(object sender, GridViewDeleteEventArgs e)
    //{
    //    string username = SearchResult.DataKeys[e.RowIndex]["UserName"].ToString();
    //    Jscript.OpenWebFormSize("SysUserDetail.aspx?UserName=" + username + "", 600, 500, 10, 100);
    //   // return;
    //}
    protected void SearchResult_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
       SearchResult.PageIndex= e.NewPageIndex;
       searchBand();
    }
}
